package logic

import (
	"context"
	"rikao2/model/model"

	"rikao2/rikao2rpc/internal/svc"
	"rikao2/rikao2rpc/rikao2rpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListLogic {
	return &ListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ListLogic) List(in *rikao2rpc.ListRequest) (*rikao2rpc.ListResponse, error) {
	// todo: add your logic here and delete this line
	var list model.User
	var lists []*rikao2rpc.ShopList

	List, err := list.ShopList(model.DB, lists, in)
	if err != nil {
		return nil, err
	}

	return &rikao2rpc.ListResponse{
		List: List,
	}, nil
}
